home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
usenet
/
sources
/
volume2
/
unix
/
shel301a.3
< prev
next >
Wrap
Internet Message Format
|
1988-12-06
|
34KB
Path: xanth!ames!ncar!mailrus!ulowell!page
From: page@swan.ulowell.edu (Bob Page)
Newsgroups: comp.sources.amiga
Subject: v02i089: shell - csh-like shell v3.01a, Part03/03
Message-ID: <10490@swan.ulowell.edu>
Date: 5 Dec 88 22:33:45 GMT
Organization: University of Lowell, Computer Science Dept.
Lines: 1153
Approved: page@swan.ulowell.edu
Submitted-by: PERUGIA@ICNUCEVM.BITNET (Cesare Dieni)
Posting-number: Volume 2, Issue 89
Archive-name: unix/shell301a.3
# This is a shell archive.
# Remove everything above and including the cut line.
# Then run the rest of the file through sh.
#----cut here-----cut here-----cut here-----cut here----#
#!/bin/sh
# shar: Shell Archiver
# Run the following text with /bin/sh to create:
# shell.doc
# This archive created: Mon Dec 5 17:26:07 1988
cat << \SHAR_EOF > shell.doc
INSTRUCTIONS FOR SHELL Version: 3.01A 17-Nov-88
===============================================
Contents
--------
I. Description
II. Overview of Major features
III. Restrictions
IV. PIPES
V. Command Pre-processor
VI. Command Line Editing
VII. Function Keys
VIII. Shell Commands
IX. Special Set Variables
X. Advanced Topics
XI. Example login file
XII. Example script file
XIII. Default values
O. Changes over version 3.00A
--------------------------
- Fixed bug with strings: before it printed strings with lenght 1 more
than specified lenght.
- Made some additions and corrected many errors in Shell.doc (this file).
- Modified handler of external commands to allow things like DATE "?"
(always use quotes).
- Corrected cat: it didn't work with STDIN before.
I. Description
-----------
This version of Shell is the follow of:
Shell V2.04 (C)Copyright 1986, Matthew Dillon, All Rights Reserved
Shell V2.04M-V2.07M by Steve Drew
Shell V2.08MI and V3.xxA by Carlo Borreo & Cesare Dieni
Send suggestions/criticism/anything else to Carlo Borreo or Cesare Dieni at:
BITNET: PERUGIA@ICNUCEVM.BITNET
or
Carlo Borreo Cesare Dieni
Via G. Berio 34 Via G. Taddei 3
I-18100 Imperia I-56100 Pisa
Italy Italy
For older version: Steve Drew at:
ENET: CGFSV1::DREW
ARPA: drew%cfgsv1.dec.com@decwrl.dec.com
USENET: {decvax|decwrl}!cgfsv1.dec.com!drew
or
52 Castledale Cres N.E.
Calgary, Alberta
Canada
You may distribute this program for non-profit only.
II. OVERVIEW
--------
Shell provides a convient AmigaDos alternative command interface.
All its commands are internal and thus does not rely on the c:
commands for any functionality.
Major features include:
-command line editing
-shell & Amigados search path support
-simple history
-redirection of any command
-piping
-aliases
-variables & variable handling (embedded variables)
-file name expansion via conventional wild carding ('?', '*' and more)
-conditionals (if/else ect..)
-source files (w/ gotos and labels)
-many built in commands to speed things up
III. RESTRICTIONS
------------
o AmigaDos execute command will not work. Alternative is to use shell
own script language (which is more powerful) or to do a 'run execute'.
o This version runs UNDER WORKBENCH 1.2 or 1.3.
o VDK handler has a bug with setting file dates so when using the copy
command and VDK you should use the -d switch otherwise your file date
in vdk: will be bad. (This is not a bug with shell)
o If using with conman it may be best to start shell with the -a switch
(shell -a .login) to turn off shell's command line editing and use
conmans instead.
IV. NOTES ON PIPES
--------------
PIPES have been implimented using temporary RAM: files. Thus, you
should be careful when specifying a 'ram:*' expansion as it might
include the temp. files. These files are deleted on completion of
the pipe segment.
The file names used are completely unique, even with multiple shell
running simultaniously.
My favorite new feature is the fact that you can now redirect to and
from, and pipe internal commands. 'echo charlie >ram:x', for
instance. Another favorite:
echo "echo mem | shell" | shell
To accomplish these new features, I completely re-wrote the command
parser in execom.c
NO BCPL program should be output-append redirected (>>).
V. COMMAND PRE-PROCESSOR
---------------------
Preprocessing is done on the command line before it is passed on to
an internal or external routine:
^c where c is a character is converted to that control character.
Thus, say '^l' for control-l.
$name where name is a variable name. Variable names can consist of
0-9, a-z, A-Z, and underscore (_). The contents of the
specified variable is used. If the variable doesn't exist,
the specifier is used. That is, if the variable 'i' contains
'charlie', then '$i' -> 'charlie'. If the variable 'i' doesn't
exist, then '$i'->'$i' .
; delimits commands. echo charlie ; echo ben.
' ' (a space). Spaces delimit arguments.
"string" a quoted string. For instance, if you want to echo five spaces
and an 'a':
echo a -> a
echo " a" -> a
\c overide the meaning of special characters. '\^a' is a
circumflex and an a rather than control-a. To get a backslash,
you must say '\\'.
also used to overide alias searching for commands.
>file specify output redirection. All output from the command is
placed in the specified file.
>>file specify append redirection (Does not work with BCPL programs).
<file specify input redirection. The command takes input from the
file rather than the keyboard (note: not all commands require
input; it makes no sense to say 'echo <charlie' since
the 'echo' command only outputs its arguments).
| PIPE specifier. The output from the command on the left becomes
the input to the command on the right. The current SHELL
implimentation uses temporary files to store the data.
!! execute the previously executed command.
!nn (nn is a number). Insert the history command numbered n (see
the HISTORY command)
!partial search backwards through the history list for a command which
looks the same as 'partial', and execute it.
# Enter comment. The rest of the line is discarded (note: \#
will, of course, overide the comment character's special
meaning)
VI. COMMAND LINE EDITING
--------------------
o Command line can be upto 255 chars.
o Inserts and deletes are handled correctly over multiple screen lines.
o Shell will keep track of the line width should the window get resized.
KEY DEFINITIONS:
Up Arrow Recal previous commands
Down Arrow Recal commands
Left Arrow Move cursor about command line.
Right Arrow " " " " "
Shift-Up Arrow Get start of history
Shift-Down Arrow " end " "
Shift-Left Arrow Moves cursor a bit left
Shift-Right Arrow " " " " right
^A Toggle insert/overtype mode.
^D EOF
^E Put cursor at end of text.
^K Delete to end of line.
^R Retype current line.
^U Erase entire line.
^X Erase entire line.
^Z Put cursor at start of text.
f1 - f10 Execute command if variable exists.
F1 - F10 More commands (Shifted f keys).
Help Invokes help command
VII. FUNCTION KEYS
-------------
Function keys now insert text to the current position on the command
line. They maybe terminated with a ^M (return). f1 would be non shifted
where as F1 is shifted.
Most of functions key have a default definition, but it may be changed.
$ set f1 dir df0:^M
will add the text 'dir df0:<return>' to the current line.
$ set f1 dir
would only add 'dir' you could then enter ' df0:<return>'
VIII. SHELL COMMANDS
---------------
First to start shell from a CLI
shell [-a] [-c command;command]
where:
-a disables all command line editing features. This is useful for
when running shell over AUX:.
-c allows execution of one command line and then exits out of shell.
This is useful for running a internal shell commands in the
background or from an external application. eg:
Run shell -c dir df0:; copy -r df0: df1: >nil:; echo "Done"
If you 'Run' shell in the background without the -c switch shell
will detect this and imediatley exit.
Command execution:
Internal shell commands maybe abreviated.
The first argument is the command-name... if it doesn't exist in the
list below and isn't an alias, it is assumed to be an external (disk)
command. At this point the shell pathing, and AmigaDos pathing is checked
in order to locate the command.
AUTOMATIC SOURCING may be accomplished by naming shell scripts with a
.sh suffix. Thus, if you say 'stuff' and the file 'stuff.sh' exists in
your current or C: directory or anywhere in Shell search path, it will
be SOURCED with any arguments you have placed in the $_passed variable.
This is equivalent to typing 'source stuff.sh'
Wild card expansions:
Most shell commands will accept multiple arguments that can
be as a result of wild card expansion. Also when the calling
an external command shell will first expand any wild cards
to seperate arguments. If you wish to have the external command
handle it's own wild carding you will need to insert quotes
around the special wild card characters ? and *.
eg.
arc a new.arc *.txt - shell will expand and pass to arc
arc a new.arc "*.txt" - let arc expand the wild cards.
Wild card expansions:
? match any single character
* match any string
.../* recursive search down ALL sub directories from current level
! Exclude pattern matching specifier
& prefixed to patterns, ask confirmation for each file
Examples:
df0:.../* all files in all directories on df0:
df0:.../!*.info full directory tree of df0: but exclude
any ugly .info files.
!*.o !*.c will result in ALL files matching since what
doesn't match the !*.o will match the !*.c
df1:&* all files in root of df1:, but ask
confirmation for each
LIST OF COMMANDS:
-----------------
ABORTLINE
Usage : abortline
Example : echo a;abort;echo b
Results : a
Causes the rest of the line to be aborted. Intended for use in
conjunction with exception handling.
ADDBUFFERS
Usage : addbuffers drive buffers
Example : addbuffers df0: 24
Just like AmigaDOS addbuffer command, causes new buffers to be
allocated for disk I/O. Each buffer costs 512 bytes of CHIP memory.
ALIAS
Usage : alias [name [command string] ]
Example : alias vt "echo Starting VT100;run sys:tools/vt100"
Sets a name to be a string. You can alias a single name to a set
of commands if you enclose them in quotes as above. By simply
typing vt, the command line above would be executed.
Argument Passing to an Alias:
Usage : alias name "%var [command string]"
Example : alias xx "%q echo hi $q, how are ya."
xx Steve
Results : hi Steve, how are ya.
The second form of the alias command allows passing of arguments
to any position within the command string via use of a variable
name. To pass arguments to the end of a command string this method
is actually not necessary.
Typing "alias name" you will get the alias for that name, while with
"alias" you get a list of all alias.
ASET
Usage : aset name value
Example : aset INCLUDE include:
Set a variable in a way that is compatible with Aztec SET command;
this is completely different from Shell variable.
May even be used to set ARP variables.
ASSIGN
Usage : assign [logical [physical] ]
Example : assign C: df1:c
Use it like AmigaDOS assign command to set, remove or list
assignments of logical names to directories.
CAT
Usage : cat [-n][file file....]
Example : cat foo.txt
Type the specified files onto the screen. If no file is specified,
STDIN in used. CAT is meant to output text files only.
Specifying -n option you will get numbered lines.
CD
Usage : cd [path]
Example : cd df0:devs/printers
Change your current working directory. You may specify '..' to go
back one directory (this is a CD specific feature, and does not
work with normal path specifications).
CD without any arguments displays the path of the directory you
are currently in.
CLOSE
Usage : close filenumber
Close the specified file opened by open.
See open and flist for more info.
COPY
(CP)
Usage : copy [-u][-d] file file
or : copy [-u][-d] file1 file2...fileN dir
or : copy [-r][-u][-d] dir1 dir2...dirN dir
options :
-r recursive, copy all subdirectories as well.
-u update, if newer version exist on dest, don't copy
-d don't set destination file date to that of source.
Example : copy -r df0: df1:
Copy files or directories. When copying directories, the -r option
must be specified to copy subdirectories as well. Otherwise, only
top level files in the source directory are copied.
All files will be displayed as they are copied and directory's
displayed as they are created. This output can be suppessed by
redirecting to nil: eg. copy -r >nil: df0: df1:
Copy will abort after current file on Control-C.
Copy by default sets the date of the destination file to that of
the source file. To overide this feature use the -d switch.
Another useful option is the -u (update) mode were copy will not
copy any files which exists already in the destination directory
if the destination file is newer or equal to the source file.
This is useful when developing code say in ram: eg. 'copy *.c ram:'
when done you can copy -u ram: df1: and only those modules you have
modified will be copied back.
Copy command will now create the destination directory if it does
not exist when specified as 'copy [-r] dir dir'. If you specify
copy file file file dir, then 'dir' must already exist.
CP
Equivalent to copy.
DEC
Usage : dec varname [value]
Example : dec abc
Decrement the numerical equivalent of the variable with specified
value (default: 1) and place the ASCII-string result back into
that variable.
DELETE
(RM)
Usage : delete [-p][-r] file file file...
Example : delete foo.txt test.c
Remove (delete) the specified files. Remove always returns
errorcode 0. You can remove empty directories. The '-r' option
will remove non-empty directories by recursively removing all sub
directories.
You can remove delete-protected files specifying -p option.
If you specify any wildcard deletes the files will be listed as
they are deleted. This can be suppressed by redirecting to nil:
DIR
(LS)
Usage : dir [-sdf] [path path ... ]
Example : dir df0:
options :
-s short multi(4) column display.
-d list directories only
-f list files only
Displays a directory of specified files. Default output shows
date, protection, block size, byte size and total space used.
Protections flags include new 1.2/1.3 flags (see under protect).
Files are alphabetically sorted, without case sensitivity, and
directories are always in red pen.
DISKCHANGE
Usage : diskchange drive
Like AmigaDOS diskchange.
ECHO
Usage : echo [-n] string
Example : echo hi there
Results : hi there
Echo the string given. If -n switch given no newline is
appended.
ELSE ;
Usage : else ; command
Usage : if -f foo.c ; else ; echo "Not there" ; endif
Else clause, must follow an IF statement.
ENDIF
Usage : endif
The end of an if statement.
Note: if you return from a script file with unterminated IF's
and the last IF was false, prompt will be changed to an
underscore ('_') and no commands will be executed until
'endif' is typed.
FAULT
Usage : fault error1 .. errorN
Example : fault 205 212
Like AmigaDOS fault, prints specified error messages.
FILENOTE
Usage: filenote file1 .. filen note
Set AMIGADOS comment of the specified file. This is not very useful,
since in current implementation of Shell file comments are not listed
in directory, but it was so easy to implement...
FLIST
Usage : flist
Lists the filenumbers of files opened by open.
See open and close for more info.
FOREACH
Usage : foreach varname ( strings ) command
Example : foreach i ( a b c d ) "echo -n $i;echo \" ha\""
Result : a ha
b ha
c ha
d ha
'strings' is broken up into arguments. Each argument is placed in
the variable 'varname' in turn and 'command' executed. To execute
multiple commands, place them in quotes.
Foreach is especially useful when interpreting passed arguments in
an alias.
eg.
foreach i ( *.pic ) viewilbm $i
assuming a.pic and b.pic in current directory the following commands
will occur:
viewilbm a.pic
viewilbm b.pic
FOREVER
Usage : forever command
or : forever "command;command;command..."
The specified commands are executed over and over again forever.
-Execution stops if you hit ^C
-If the commands return with an error code.
GOTO
Usage : goto label
Example :
label start
echo "At start"
dir ram:
goto start
Goto the specified label name. You can only use this command from a
source file. Labels may now be forward or reverse from current
position.
HELP
Usage : help
Example : help
Simply displays all the available commands. The commands are
displayed in search-order. That is, if you give a partial name
the first command that matches that name in this list is the one
executed. Generally, you should specify enough of a command so that
it is completely unique.
HISTORY
Usage : history [partial_string]
Example : history
Displays the enumerated history list. The size of the list is
controlled by the _history variable. If you specify a partial-
string, only those entries matching that string are displayed.
HOWMANY
Usage : howmany
This command tells you how many instances of Shell are running
in your system.
HTYPE
Usage : htype file1 .. filen
Displays the specified files in hex and ASCII, just like the system
command Type file opt h. Especially suitable for binary files.
IF
Usage : if [-n] argument conditional argument ;
or : if [-n] argument
or : if [-n] -f file
or : if [-n] -d file/dir
or : if [-n] -m
or : if [-n] -t file file1 .. fileN
or : if [-n] -r rpnexpression
If a single argument is something to another argument. Conditional
clauses allowed:
<, >, =, and combinations (wire or). Thus <> is not-equal, >=
larger or equal, etc...
If arguments are not numeric, they are compared as strings.
Usually the argument is either a constant or a variable ($varname).
The second form if IF is conditional on the existance of the argument.
If the argument is a "" string, then false , else TRUE.
The third form of IF used by -f switch checks for existance of
the specified file.
Switch -d tests the type of the object specified: if it is a
directory, then TRUE; if it is a file (or it doesn't exist)
then FALSE.
Switch -m is used to test if FAST memory is present, i.e. wheter
more than 512K RAM are available.
Example (to be included in a login.sh file):
if -m; resident -a as ln cc; endif
Using -t form compares the date and time of the first file with
all the others; if the first is younger than ALL the others, then
FALSE, else TRUE. If a file doesn't exists, it is considered as
being older.
This feature is especially useful for building makefiles without
using any MAKE utility.
Example:
if -t test.o test.asm test.i ; asm -o test.o test.asm ; endif
Option -r evaluates a given RPN expression (see under RPN for more
info): if value on top of stack is 0, then FALSE, else TRUE.
Switch -n (NOT) reverses the result.
When using 'IF' command interactively if you are entering commands
following an 'IF' that was false, the prompt will be set to a
underscore '_ ' to indicate all commands will be ignored until
an 'ELSE' or 'ENDIF' command is seen.
INC
Usage : inc varname [value]
Example : inc abc 5
Increment the numerical equivalent of the variable with specified
value (default: 1) and place the ascii-string result back into
that variable.
INFO
Usage : info
Display Device statistics for all the disk-type devices in system
(DFk:, HDk, JHk:, RAM:, RDk: ...), just like the system command
info. Gives block used/free, % used, errs, status and volume name.
INPUT
Usage : input var var ... var
Example : input abc
Input from STDIN (or a redirection, or a pipe) to a variable. The
next input line is placed in the variable.
JOIN
Usage : join [-r] file1..fileN destfile
Example : join part1 part2 part3 total
Joins the specified files to get destfile. If destfile already
exists, an error message is generated and operation is aborted,
unless you specify -r (replace) option.
LABEL
Usage : label name
Create a program label right here. Used in source files, can then
GOTO a label.
LS
Equivalent to dir.
MD
Equivalent to mkdir.
MEM
Usage : mem
Display current memory statistics for CHIP memory and
FAST memory (if any installed).
MKDIR
(MD)
Usage : mkdir name name name...
Example : mkdir df0:stuff
Create the specified directories.
MV
Equivalent to rename.
OPEN
Usage : open filename filemode filenumber
Example : open RAM:data w 1
This allows you to open a file, redirect to it as many commands
as you like, then close it.
Filename is any valid AmigaDOS filename, filemode is either r
for read or w for write, filenumber is a number between 1 and 10.
To redirect a program to or from an open file, use as your redir
filename a dot followed by the filenumber.
Here is a complete example:
open RAM:data w 1
echo -n 2+2= >.1
rpn 2 2 + . CR >.1
close 1
type RAM:data # will display 2+2=4
See also close, flist.
PATH
Usage : path
Used to list AmigaDOS path. In current version can't be used to
set it.
PRI
Usage : pri clinumber pri
Example : pri 1 20
Change the priority of the specified task (use PS command to
determine clinumber).
PROTECT
Usage : protect file1 ... filen [flags]
Example : protect myfile rwe
Set AMIGADOS file protection flags for the file specified. Valid
flags are h, s, p, a, r, w, e, d.
If you don't specify the flags, all flags are cleared.
Bit 'a' is new to WorkBench 1.2, while 'h', 's', 'p' are new to 1.3.
PS
Usage : ps
Gives status of DOS processes. eg:
Proc Command Name CLI Type Pri. Address Directory
1 SHELL Initial CLI 0 97b0 Stuff:shell
2 sys:c/clockmem Background -10 2101a8 Workdisk:
3 c:emacs Background 0 212f58 Stuff:shell
4 sys:c/VT100 Background 0 227328 Workdisk:
Address is the addres of the task, directory is the process
currently CD'd directory.
PWD
Usage : pwd
Rebuild _cwd by backtracing from your current directory.
QUIT
Usage : quit
Quit out of Shell back to CLI.
RBACK
Usage : rback command
Start a new process executing the specified command, but can't do
input/output. Equivalent to 'run command >NIL: <NIL:'.
This command is not fully reliable: use at your own risk.
RENAME
(MV)
Usage : rename from to
or : rename from from from ... from todir
Allows you to rename a file or move it around within a disk.
Allows you to move 1 or more files into a single directory.
RESIDENT
Usage : resident [-a][-r] [files]
This is ARP resident. Commands are searched by Shell in resident
list BEFORE of searching on any external device.
Option -a loads RESIDENT programs, -r removes them.
Resident with no args lists resident programs.
Not all programs can run as resident, see ARP docs for more info.
RETURN
Usage : return [n]
Example : return 10
Exit from a script file, or quit from shell with optional
exit code.
RM
Equivalent to delete.
RPN
Usage : rpn expression
Example : rpn 3 7 * . CR # Prints the value 21
Evaluate an RPN expression. May be useful for simple calculations,
but needs some work to be really useful. Uses only 32-bit values.
Use "rpn help" to get a list of commands, with the number of
arguments and of results.
Here are some commands:
. Prints value on stack
CR Prints a CR
STR Use "STR string" to get a pointer to string on stack
LEN, STRCMP, SETVAR String operations
RUN
Usage : run prgm args
Example : run emacs test.c
Start a new process executing the specified command.
In current implementation run command can't be redirected.
This command is not fully reliable: use at your own risk.
See also rback.
SEARCH
Usage : search [-w][-c][-n][-r][-e][-q] filelist string
Search specified files for a string. Only lines containing the
specified strings are displayed.
If you specify any directory in filelist, and use the -r (recurse)
switch, all files in directory are recursively searched.
Lines are numbered for default; use -n (number) switch to turn off
line numbering.
Search is normally not case sensitive; use -c (case) flag to turn ON
case sensitivity.
By specifying -e (exclude) switch, only lines NOT containing the
specified string are listed.
Using -w (wild) flag, only the lines matching with the string are
listed.
Notes to wild card matching;
- Uses Shell standard matching.
- Wild cards allowed are *, ?, !.
- Matching is not case sensitive (even if you use -c flag).
- The WHOLE line must match the string, not only a substring.
- String MUST be enclosed in quotes to avoid wildcard expansion
Flag -q (quiet) suppresses printing of file names.
Examples:
search -c -r df0:include ACCESS
Find all occurrencies of ACCESS (in uppercase) in all files
contained in include directory.
search -w shell.h "#define*"
Lists only lines of file beginning with (not simply containing)
#define.
SET
Usage : set [name] [string]
Example : set abc hello
Set with no args lists all current variable settings.
Set with one arg lists the setting for that particular variable.
Specifying name and string, stores the string into variable name.
Also See the section on special _variables.
SLEEP
Usage : sleep timeout
Example : sleep 10
Sleep for 'timeout' seconds, or until ^C typed.
STACK
Usage : stack [number]
Example : stack 8000
Changes the default stack for this CLI. Without arguments, prints
it.
STRHEAD
Usage : strhead varname breakchar string
Example : strhead j . foobar.bas
echo $j
Result : foobar
Remove everything after and including the breakchar in 'string' and
place in variable 'varname'.
STRINGS
Usage : strings file1..fileN minlenght
Example : strings c:dir c:list shell 7
Prints strings contained in specified files (usually binary)
with lenght >= minlenght.
STRTAIL
Usage : strtail varname breakchar string
Example : strtail j . foobar.bas ; echo $j
Result : bas
Remove everything before and including the breakchar in 'string' and
place in variable 'varname'.
SOURCE
Usage : source file [arguments]
Example : source mymake.sh all
Result : source file 'mymake.sh' called with var _passed = 'all'
Execute commands from a file. You can create SHELL programs in
a file and then execute them with this command. Source'd files
have the added advantage that you can have loops in your command
files (see GOTO and LABEL). You can pass SOURCE files arguments
by specifying arguments after the file name. Arguments are passed
via the _passed variable (as a single string).
Automatic 'sourcing' is accomplished by placing a .sh extension on
the file and executing it as you would a C program:
--------- file hello.sh ---------
foreach i ( $_passed ) "echo yo $i"
---------------------------------
$ hello a b c
yo a
yo b
yo c
TYPE
Equivalent to CAT.
TOUCH
Usage : touch file1 .. fileN
Sets DateStamp on the specified files to the current date and time.
UNALIAS
Usage : unalias name .. name
Example : unalias vt
Delete aliases..
UNSET
Usage : unset name .. name
Example : unset abc
Unset one or more variables. Deletes them entirely.
VER
Usage : ver
Show current version name, & authors.
WINDOW
Usage : window [-q][-f][-b][-l][-s] [dimensions]
Options :
-f (front) Window to front
-b (back) Window to back
-l (large) Window to maximum size
-s (small) Window to minimum size
-a (activate)
-q (query) Lists screens and windows open
Various operations on CLI window. If dimensions are specified,
they must be in the form x y width height, with values separated
by spaces.
The command "window -l" may be very useful on PAL machines to
get a full PAL window from your login sequence.
Switching very fast back and forth from small to big window may
cause an apparent lock-up; in this case, just resize the window
with the mouse.
IX. SPECIAL SET VARIABLES
---------------------
_prompt
This variable is set to the string you wish printeded as your
prompt. This can contain escape sequences if you wish, or
you can include a %p in path definition to get CD in your
prompt.
Default prompt shows path specification in red pen, followed by
a greater (>) sign and a space.
The if command will set the prompt to a '_ ' if commands are
disabled while waiting for a 'endif' or 'else' command. Interactive
mode only.
_history
This variable is set to a numerical value, and specifies how far
back your history should extend.
_debug
Debug mode... use it if you dare. must be set to some value
_verbose
Verbose mode (for source files). display commands as they are
executed.
_maxerr
The worst (highest) return value to date. To use this, you usually
set it to '0', then do some set of commands, then check it.
_lasterr
Return code of last command executed. This includes internal
commands as well as external comands, so to use this variables
you must check it IMMEDIATELY after the command in question.
_cwd
Holds a string representing the current directory we are in from
root. The SHELL can get confused as to its current directory if
some external program changes the directory. Use PWD to rebuild
the _cwd variable in these cases.
_passed
This variable contains the passed arguments when you SOURCE a file
or execute a .sh file. For instance:
test a b c d
-------- file test.sh ----------
echo $_passed
foreach i ( $_passed ) "echo YO $i"
--------------------------------
_path
This variable contains the search path when the shell is looking
for external commands. The format is: DIR,DIR,DIR Each DIR must
have a trailing ':' or '/'. The current directory is always
searched first. The entire path will be searched first for the
<command>, then for <command>.sh (automatic shell script sourcing).
The default _path is set to
ram:,ram:c/,df0:c/,df1:c/,df0:,df1:,sys:system/
_insert
Sets the default for insert/overtype mode for command line
editing. ^A toggles between, but after <RET> the default is
set back as indicated by this variable. By default _insert is 1
indicating insert mode on setting to zero will make overtype
the default.
_width
Indicates the console window width, 77 if unset.
Will change automatically if the user resizes the window.
_titlebar
Used to set window's title bar.
X. ADVANCED TOPICS
---------------
EXCEPTION_PROCESSING:
if no _except variable exists, any command which fails causes the
rest of the line to abort as if an ABORTLINE had been executed. If
the _except variable exists, it is of the form:
"nnn;commands..."
where nnn is some value representing the minimum return code required
to cause an error. Whenever a command returns a code which is
larger or equal to nnn, the commands in _except are executed before
anything. WHEN _except EXISTS, THE COMMAND LINE DOES NOT ABORT
AUTOMATICALLY. Thus, if you want the current line being executed
to be aborted, the last command in _except should be an "abortline".
exception handling is disabled while in the exception handling routine
(thus you can't get into any infinite loops this way).
Thus if _except = ";", return codes are completely ignored.
example:
set _except "20;abortline"
XI. EXAMPLE LOGIN FILE
------------------
From a CLI or the startup-script say 'SHELL filename'. That file is
sourced first. Thus, 'SHELL .login' will set up your favorite aliases.
# -Steve's .login file- #
echo -n "Enter Date [DD-MMM-YY HH:MM] ";input new; DATE $new
# -------Function keys-------- #
set f1 "dir df0:"^M
set f2 "dir df1:"^M
set F1 "dir -s df0:"^M
set F2 "dir -s df1:"^M
set f3 info^M
set f4 ps^M
# ---------Quickies---------- #
alias print "%q copy $q prt:"
alias tosys "assign c: SYS:c"
alias toram "assign c: RAM:c;"
alias tomanx "assign c: MANX:c; manxinit"
alias wb "loadwb"
alias pref "sys:preferences"
alias cal "run sys:utilities/calculator"
# ------Applications---------- #
alias em "run emacs"
alias vt "run sys:c/VT100"
# --------Finish Up----------- #
ver ;echo -n "Shell loaded on ";date
XII. Example Source file
-------------------
# ---- MANXINIT.SH ------ #
aset INCLUDE AC:include
aset CCTEMP=ram:
md ram:lib
aset CLIB RAM:lib/
cp AC:lib/$libfile ram:lib"
alias cleanup "rm >NIL: -r ram:lib"
#run make in background at lower priority:
alias make "%q run ChangeTaskPri -5 +^J^J MAKE $q"
XIII. Default Values
--------------
To make things easier, some aliases are predefined whenever you start a
new Shell. These are:
- cls
Simply clear the screen.
- cdir
Use "cdir directory" to clear the screen, set CD to directory,
and list it.
- kr
Deletes everything on RAM:. If you think this is dangerous,
you can remove this alias.
- exit
Leave Shell and exit CLI.
Moreover, many variables have default values, and many function keys are
predefined. You can use set command to determine all of these.
SHAR_EOF
# End of shell archive
exit 0
--
Bob Page, U of Lowell CS Dept. page@swan.ulowell.edu ulowell!page
Have five nice days.